﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mevsukovGames
{
    class CoordinateCalculator
    {
        private int _xStartPoint;
        private int _yStartPoint;
        private int _gameFieldHeight;
        private int _gameFieldWidth;

        
        public CoordinateCalculator(int xStartPoint, int yStartPoint, int gameFieldWidth, int gameFieldHeight)
        {
            _xStartPoint = xStartPoint;
            _yStartPoint = yStartPoint;
            _gameFieldWidth = gameFieldWidth;
            _gameFieldHeight = gameFieldHeight;
        }

        public int ConsoleXToGameField(int xConsole)
        {
            return xConsole - _xStartPoint - 1;
        }

        public int ConsoleYToGameField(int yConsole)
        {
            return yConsole - _yStartPoint - 1;
        }

        public int GameFieldXToConsole(int xGameField)
        {
            return xGameField + _xStartPoint + 1;
        }

        public int GameFieldYToConsole(int yGameField)
        {
            return yGameField + _yStartPoint + 1;
        }
    }
}
